# 面对什么问题
# 现实问题怎么解决
# 编程怎么解决

# 记录生肖，根据年份来判断生肖
from typing import List

chinese_zodiac = '猴鸡狗猪鼠牛虎兔龙蛇马羊'

# 切片操作符
print(chinese_zodiac[0])
print(chinese_zodiac[0:4])
print(chinese_zodiac[2:])
print(chinese_zodiac[:-5])

# 成员关系操作符
print("狗" in chinese_zodiac)
print("狗" not in chinese_zodiac)

# 连接操作符
print(chinese_zodiac + chinese_zodiac)
print(chinese_zodiac + 'aaa')

# 重复操作符
print(chinese_zodiac * 3)

year = 2018
# year1 = int(input("请输入年份："))
# print(year%12)
print("您的生肖为：%s" % chinese_zodiac[year % 12])

# 元组嵌套（不可变更）
a = (1, 2, 3, 4)
b = 4
filter(lambda x: x < b, a)
list(filter(lambda x: x < b, a))
len(list(filter(lambda x: x < b, a)))  # 小于4元素的个数
zodiac_name = (u'摩羯座', u'水瓶座', u'双鱼座', u'白羊座', u'金牛座', u'双子座',
               u'巨蟹座', u'狮子座', u'处女座', u'天秤座', u'天蝎座', u'射手座')
zodiac_days = ((1, 20), (2, 19), (3, 21), (4, 21), (5, 21), (6, 22),
               (7, 23), (8, 23), (9, 23), (10, 23), (11, 23), (12, 23))

# 列表（可变更）append pop filter
(month, day) = (3, 15)
zodiac_day = filter(lambda x: x <= (month, day), zodiac_days)
# print(zodiac_day)
print(list(zodiac_day))
zodiac_len1 = len([(1, 20), (2, 19)]) % 12
zodiac_len = len(list(zodiac_day)) % 12
print(zodiac_len)
print("您的星座为：%s" % zodiac_name[zodiac_len])

a_list: List[str] = ['abc', 'xyz']
a_list.append('X')
a_list.remove('abc')
print(a_list)

for cz in chinese_zodiac:
    print(cz)

for i in range(1, 13):
    print(i)

for year2 in range(2000, 2009):
    print("%年的生肖是%" % (year2, chinese_zodiac[year2 % 12]))
print("aaaaa")
